-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[feat/refactor] AllColumns and AllTableColumns-Support for JSON_OBJECT #2323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat/refactor] AllColumns and AllTableColumns-Support for JSON_OBJECT #2323
Conversation
…ded Feature to disable Commas as key value separators
Did a bit more work here, and I think it's ok for now. Some thoughts:
I see a lot of potential issues with incompatible syntaxes in the future, we should probably think about how to solve them. I know that the library is designed as a general, language agnostic parser, but at some point it's simply not possible to support everything without specifying the expected syntax... |
JMH on master (without this PR):
JMH on this PR:
|
Thank you for your work and effort. No objections from my side and I will merge when you are ready. |
Thank you, please go ahead and merge, this PR is good from my side. I'll probably have a look at JSON_TABLE next |
Next time please check for those warnings too:
|
Yeah, didn't look for the JavaCC-Warnings. I'll check those and make another PR to fix them |
No worries, I did that already. Good team effort: you do the heavy lifting and leave the easy work to me. Cheers and best! |
This adds support for the
JSON_OBJECT(*)
andJSON_OBJECT(t1.*, t2.*)
syntax, reference is here: https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/JSON_OBJECT.htmlWhile working on this, I noticed that the current handling is a bit off:
In OBJECT_POSTGRES mode, the separate entries are stored in key and value of a single keyValue, and the AllColumns and AllTableColumns-Objects would end up there as well.
As it is possible to mix actual key value pairs and AllTableColumns (
JSON_OBJECT(t1.*, 'name' : t2.name, t3.*)
) we need to make sure that each "entry" gets it's own KeyValuePair, with just the key (or value) set.I'm not sure how breaking changes are handled here. The PR so far is binary compatible, i.e. the API is backwards compatible, but the behaviour changed slightly.
OBJECT_MYSQL and OBJECT_POSTGRES are not used anymore. Instead the JsonKeyValuePair now has a "separator"-Field that describes how the key and the value are rendered. There is one entry NOT_USED in case the KeyValuePair has only one value.
Open questions:
I plan to work on this a bit more, also the JsonAggregateFunction should probably be adapted as well, but I'd like to get your opinion on the whole thing first.